model {
for (i in 1:n){
trans.ndo[i] ~ dbin (p.bound[i], 1)
p.bound[i] <- max(0, min(1, p[i]))
logit(p[i])<-Xbeta[i]
Xbeta[i] <- b.0 + b.female*female[i] + b.black*black[i] + b.age[age.cat[i]] + b.female.black*female[i]*black[i] + b.educ[educ[i]] + b.state[state.number[i]]
}

b.0 ~ dnorm (0, .0001)
b.black ~ dnorm (0, .0001)
b.female ~ dnorm (0, .0001)
b.female.black ~ dnorm (0, .0001)

for (j in 1:n.age) { b.age[j] ~ dnorm (0, tau.age)}
for (j in 1:n.educ) { b.educ[j] ~ dnorm (0, tau.educ)}
for (j in 1:n.state) {b.state[j] ~ dnorm(b.state.hat[j], tau.state)
b.state.hat[j] <- b.region[sregion.num[j]]}


for (j in 1:n.region){ b.region[j] ~ dnorm (0, tau.region)}

tau.age <- pow(sigma.age, -2)
tau.educ <- pow(sigma.educ, -2)
tau.state <- pow(sigma.state, -2)
tau.region <- pow(sigma.region, -2)

sigma.age ~ dunif (0, 100)
sigma.educ ~ dunif (0, 100)
sigma.state ~ dunif (0, 100)
sigma.region ~ dunif (0, 100)
}